var tab = {
	//text
	item: function(id,tag,type,speed,Time){
		var obj = this;
		obj.id = $(id);
		obj.index = 0;
		obj.type = type || ''; //事件
		obj.speed = speed || 2000;
		obj.Time = Time || "slow";
		obj.em = obj.id.children('dt').children('em');
		if(obj.type.length){
			obj.em.bind(type,function(){
				return Marquee(this);
			});
		}else{
			obj.id.hover(
				function(){
					clearInterval(obj.MyMar);
				},
				function(){
					obj.MyMar = setInterval(Marquee,obj.speed);
				}
			);
			obj.em.mouseover(function(){
				return Marquee(this)
			});
			obj.MyMar = setInterval(Marquee,obj.speed);
		}
		function Marquee(e){
			obj.tag = obj.id.children('dd').children(tag);
			obj.index = e?obj.em.index(e):obj.index<obj.em.length-1?obj.index+1:0;
			obj.em.eq(obj.index).addClass('off').siblings().removeClass('off');
			obj.tag.stop().hide().css({"opacity": 1}).eq(obj.index).fadeIn(obj.Time);
		}
	},
	// Pic
	Image: function(id,tag,type,speed,Time){
		var obj = this;
		obj.id = $(id);
		obj.index = 0;
		obj.type = type || ''; //事件
		obj.speed = speed || 2000;
		obj.Time = Time || 400;
		obj.em = obj.id.children('dd').children('span');
		if(obj.type.length){
			obj.em.bind(type,function(){
				return Marquee(this);
			});
		}else{
			obj.id.hover(
				function(){
					clearInterval(obj.MyMar);
				},
				function(){
					obj.MyMar = setInterval(Marquee,obj.speed);
				}
			);
			obj.em.mouseover(function(){
				return Marquee(this)
			});
			obj.MyMar = setInterval(Marquee,obj.speed);
		}
		function Marquee(e){
			obj.tag = obj.id.children('dt').children(tag);
			obj.index = e?obj.em.index(e):obj.index<obj.em.length-1?obj.index+1:0;
			obj.em.eq(obj.index).addClass('off').siblings().removeClass('off');
			obj.tag.hide().attr("src",obj.em.eq(obj.index).children().attr("src")).fadeIn(obj.Time);
		}
	}
}

function $Id(id){ return document.getElementById(id); }
var demo = {
	item: function(e){
		var box = $Id(e.id)
		var s = e.s || 1500; //停顿事件
		var px = e.px || -1 ;//滚动像素
		var can = true;
		box.innerHTML += box.innerHTML;
		box.onmouseover= function(){can = false};
		box.onmouseout = function(){can = true};
		var max = parseInt(box.scrollHeight/2);
		var h = e.h || max;	//停顿滚动高度
		new function (){
			if(can){
				var set = px<1?[0,max]:[max,0];
				box.scrollTop == set[0]?box.scrollTop = set[1]:box.scrollTop+=px;
			};
			setTimeout(arguments.callee,box.scrollTop%h?10:s);
		};
	}
}
//offer.html <dl class="detail">
function $offerDetail(obj){
	if(obj.title == "全部"){
		obj.title = "精简";
		$Id("ddspan1").style.display = "none";
		$Id("ddspan2").style.display = "";
		obj.innerHTML = obj.innerHTML.replace("全部","精简");
		obj.parentNode.style.height = $Id("ddspan2").scrollHeight + "px";
	}else{
		obj.title = "全部";
		$Id("ddspan1").style.display = "";
		$Id("ddspan2").style.display = "none";
		obj.innerHTML = obj.innerHTML.replace("精简","全部");
		obj.parentNode.style.height = 80 +"px";
	}
}